﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PingPongMain
{
    public  class Keybord : IEventHandler
    {
        public event EventHandler OnUpArrowPressed;
        public event EventHandler OnDownArrowPressed;
        public event EventHandler OnPausePressed;
        public event EventHandler OnYPressed;
        public event EventHandler OnNPressed;

        public void Processes()
        {
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.Key == ConsoleKey.UpArrow)
                {
                    this.OnUpArrowPressed(this, new EventArgs());
                }
                if (key.Key == ConsoleKey.DownArrow)
                {
                    this.OnDownArrowPressed(this, new EventArgs());
                }
                if (key.Key == ConsoleKey.Spacebar)
                {
                    this.OnPausePressed(this, new EventArgs());
                }
            }
        }
    }
}
